package com.hkrt.demo.domain.interactor

import com.hkrt.demo.di.scope.PerActivity
import com.hkrt.demo.domain.entity.Like
import com.hkrt.demo.domain.repository.HkrtRepository
import io.reactivex.Flowable
import javax.inject.Inject

/**
* @author  Chenjinguang
* @date 05.08.2017.
*/
@PerActivity
class ShotLikeInteractor @Inject constructor( val hkrtRepository: HkrtRepository) {

    var shotLikeCount: Int = 0

    fun getShotLikes(shotId: String): Flowable<List<Like>> {
        return hkrtRepository.getShotLikes(shotId)
                .doOnNext { shotLikeCount = it.count() }
    }

    fun likeShot(shotId: String) = hkrtRepository.likeShot(shotId)
}